<?php
/**
 * Created by IntelliJ IDEA.
 * User: dhy
 * Date: 2015/9/14
 * Time: 9:52
 */
namespace App\Http\Controllers\Admin\Auth;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Input;


class LoginController extends Controller{
    public function index(){
        return view("admin.auth.login");
    }
    public function login(Request $request){

        $username = $request->input('username');
        $password = $request->input('password');

        $validator = Validator::make(Input::all(),
            [
            'username' => 'required|min:6',
            'password' => 'required|min:6',
        ]);

        if($validator->fails()){
            return view("admin.auth.login")->withMessage($validator->errors()->first())->withUsername($username);
        }else{
            var_dump("fale");
            return view("admin.home")->withHome("where");
        }

    }

}